<?php

/**
 * DB class will handle all database program. DB class will also act as model
 * for table in database. All query will need to be parse through this class
 * to prevent any unauthorized injection to database.
 *
 * @author GunB0x
 */
class DB {

    private $result;
    public $db;

    function __construct() {
        $this->result = null;
        $this->db_connect();
    }

    function db_connect() {
        $host = "localhost";
        $dbuser = "root";
        $dbpass = "";

        $dbtbl = "goonline_godb";

        if (mysql_connect($host, $dbuser, $dbpass)) {
            $this->db = mysql_select_db($dbtbl);
        }
    }

    function db_select_where($tblname, $args) {
        $query = "SELECT * FROM $tblname WHERE $args";
        $result = mysql_query($query);
        $this->result = mysql_fetch_object($result);
        
        return $this->result;
    }

}

?>
